package org.yaukie.startup;

import java.util.Iterator;
import java.util.Set;
import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.HandlesTypes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaukie.startup.inter.MyJobOnStartUpInitializer;

@HandlesTypes({MyJobOnStartUpInitializer.class})
public class MyJobServletContainerInitializer implements ServletContainerInitializer {
    private static Logger logger = LoggerFactory.getLogger(MyJobServletContainerInitializer.class);

    public MyJobServletContainerInitializer() {
    }

    public void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletException {
        if (logger.isDebugEnabled()) {
            logger.debug("定时任务初始化任务开始...");
        }

        Iterator var3 = c.iterator();

        while(var3.hasNext()) {
            Class<?> myJobOnStartUpInitializer = (Class)var3.next();

            try {
                MyJobOnStartUpInitializer startUpInitializer = (MyJobOnStartUpInitializer)myJobOnStartUpInitializer.newInstance();
                startUpInitializer.init(ctx);
            } catch (InstantiationException var6) {
                var6.printStackTrace();
            } catch (IllegalAccessException var7) {
                var7.printStackTrace();
            }
        }

        if (logger.isDebugEnabled()) {
            logger.debug("定时器初始化任务结束...");
        }

    }
}
